/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Quentin L
 */
@Entity
@Table(name = "serie_has_genre")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SerieHasGenre.findAll", query = "SELECT s FROM SerieHasGenre s"),
    @NamedQuery(name = "SerieHasGenre.findBySerieId", query = "SELECT s FROM SerieHasGenre s WHERE s.serieHasGenrePK.serieId = :serieId"),
    @NamedQuery(name = "SerieHasGenre.findByGenreId", query = "SELECT s FROM SerieHasGenre s WHERE s.serieHasGenrePK.genreId = :genreId")})
public class SerieHasGenre implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SerieHasGenrePK serieHasGenrePK;

    public SerieHasGenre() {
    }

    public SerieHasGenre(SerieHasGenrePK serieHasGenrePK) {
        this.serieHasGenrePK = serieHasGenrePK;
    }

    public SerieHasGenre(int serieId, int genreId) {
        this.serieHasGenrePK = new SerieHasGenrePK(serieId, genreId);
    }

    public SerieHasGenrePK getSerieHasGenrePK() {
        return serieHasGenrePK;
    }

    public void setSerieHasGenrePK(SerieHasGenrePK serieHasGenrePK) {
        this.serieHasGenrePK = serieHasGenrePK;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (serieHasGenrePK != null ? serieHasGenrePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SerieHasGenre)) {
            return false;
        }
        SerieHasGenre other = (SerieHasGenre) object;
        if ((this.serieHasGenrePK == null && other.serieHasGenrePK != null) || (this.serieHasGenrePK != null && !this.serieHasGenrePK.equals(other.serieHasGenrePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.SerieHasGenre[ serieHasGenrePK=" + serieHasGenrePK + " ]";
    }
    
}
